package com.zbkj.dal.pojo.response.ba;

import com.zbkj.dal.base.enums.BizSharedOrderStatus;
import com.zbkj.dal.base.enums.BizShareModeEnum;
import com.zbkj.dal.entity.ba.Share;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.time.LocalDateTime;

@Data
public class MyShareResponse {

    @ApiModelProperty("id")
    private Integer id;

    @ApiModelProperty("供享订单号")
    private String orderNo;

    @ApiModelProperty("类型")
    private String shareMode;

    @ApiModelProperty("类型名称")
    private String shareModeName;

    @ApiModelProperty("订单创建时间")
    private LocalDateTime createTime;

    /**
     * @see com.zbkj.dal.base.enums.BizSharedOrderStatus
     */
    @ApiModelProperty("状态")
    private String status;

    @ApiModelProperty("状态描述")
    private String statusText;

    @ApiModelProperty("备注")
    private String remark;

    // -------------------- 商品信息 --------------------

    @ApiModelProperty("图片地址")
    private String productUrl;

    @ApiModelProperty("商品名称")
    private String productName;

    @ApiModelProperty("型号编码")
    private String code;

    @ApiModelProperty("初步估价区间-起始")
    private String estimatePriceStart;

    @ApiModelProperty("初步估价区间-结束")
    private String estimatePriceEnd;

    public static MyShareResponse buildByShare(Share share, String productUrl, String tips) {
        MyShareResponse myShareResponse = new MyShareResponse();
        myShareResponse.setId(share.getId());
        myShareResponse.setOrderNo(share.getOrderNo());
        myShareResponse.setShareMode(share.getShareMode());
        myShareResponse.setShareModeName(BizShareModeEnum.toName(share.getShareMode()));
        myShareResponse.setCreateTime(share.getCreateTime());
        myShareResponse.setStatus(share.getStatus());
        myShareResponse.setStatusText(BizSharedOrderStatus.text(share.getStatus()));
        myShareResponse.setProductUrl(productUrl);
//        myShareResponse.setProductName(share.getBrand() + share.getProductType());
        myShareResponse.setCode(share.getCode());
        myShareResponse.setEstimatePriceStart(share.getEstimatePriceStart());
        myShareResponse.setEstimatePriceEnd(share.getEstimatePriceEnd());
        myShareResponse.setRemark(tips);
        return myShareResponse;
    }
}
